<include file="Public/base"/>
<body>
    <div class="page-container">
        <form action="" method="post" class="form form-horizontal" id="commentFrom">
            <input type="hidden" name="type" value="1">
            <input type="hidden" name="id" value="{$id}">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">手机号：</label>
                <div class="formControls col-xs-3 col-sm-3">
                    <input type="text"  name="phone" id="phone" placeholder="" value="{$sale.phone}" class="input-text" >
                </div>
       			<label class="form-label col-xs-4 col-sm-2">姓名：</label>
                <div class="formControls col-xs-3 col-sm-4">
                    <input type="text" name="real_name" id="real_name" placeholder="" value="{$sale.real_name}" class="input-text">
                </div>
            </div>
             <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">身份证：</label>
                <div class="formControls col-xs-3 col-sm-3">
                    <input type="text" name="card_number" id="card_number" placeholder="" value="{$sale.card_number}" class="input-text">
                </div>
          
                <label class="form-label col-xs-4 col-sm-2">性别：</label>
                <div class="formControls col-xs-4 col-sm-4">
                <span class="select-box">
				  <select class="select sex" size="1" name="sex">
				    <option value="1">男</option>
				    <option value="2">女</option>
				  </select>
				</span>
                </div>
             </div>
      		<div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">年龄：</label>
                
                 <div class="formControls col-xs-3 col-sm-3">
                    <input type="text" name="age" id="" placeholder="" value="{$sale.age}" class="input-text">
                </div>
                 <label class="form-label col-xs-4 col-sm-2">状态：</label>
                <div class="formControls col-xs-3 col-sm-4">
                   <span class="select-box">
					  <select class="select sex" size="1" name="status">
					    <option value="0">启用</option>
					    <option value="1">禁用</option>
					  </select>
				</span>
                </div>
            </div>
            
             <div class="row cl">
       			 <label class="form-label col-xs-4 col-sm-2">所属地：</label>
       			 <div class="formControls col-xs-3 col-sm-4">
       			 <input type="text" name="manage_locations" id="" placeholder="" value="{$sale.manage_locations}" class="input-text">
                </div>
                <!-- <div id="province"></div> -->
            </div>
        <div class="row cl">
       			 <label class="form-label col-xs-2 col-sm-2">工作事项：</label>
                <div class="formControls col-xs-9 col-sm-9">
                    <input type="text" name="work_event" id="" placeholder="" value="{$sale.work_event}" class="input-text">
                </div>
            </div>
       
			 <div class="row cl">
       			 <label class="form-label col-xs-2 col-sm-2">直接上级：</label>
                <div class="formControls col-xs-9 col-sm-9">
                        <span class="select-box">
						  <select class="select" size="1" name="superior_id">
						  <volist name='supers' id='v'>
							  <option value="{$v.id}">{$v.real_name}</option>
						  </volist>
						  </select>
						</span>
                </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                    <button onClick="sub_save();" class="btn btn-secondary radius" type="button"> 提交</button>
                    <button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
                </div>
            </div>
        </form>
    </div>
    <script type="text/javascript" src="__JS__/Salemanager/area/jquery.provincesCity.js"></script>
    <script type="text/javascript" src="__JS__/Salemanager/area/provincesData.js"></script>
<!--     <script type="text/javascript" src="__STATIC__/city/jquery.provincesCity.js"></script>
    <script type="text/javascript" src="__STATIC__/city/provincesData.js"></script> -->
    <script type="text/javascript">
                        $(function () {
                            $("#province").ProvinceCity();
             				//选中性别
                            var sex = '<?php echo $sale["sex"] ?>';
                            if(sex=='1'){
                            	   $(".sex").find("option[value='1']").attr("selected",true);
                            }else{
                            		$(".sex").find("option[value='2']").attr("selected",true);
                            }
                            //选中县
                        });

                    /*     function sub_save()
                        {
                            $("#commentFrom").submit();
                        } */
                        function sub_save()
                        {
                        	
                        	//校验
                   		 var telReg = /^0?1[3|4|5|8][0-9]\d{8}$/;
                   		 if (telReg.test($("#phone").val()) === false &&$("#phone").val().trim().length > 0) { 
                   			 layer.msg("手机号输入不合法!");
                   				 return false;  
                   		  };
                   		 //姓名
                   		  if($("#real_name").val().trim().length==0){
                   			  layer.msg("姓名不能为空!");
                				 return false;  
                   		  }
                   		//身份证号码
                   		var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; 
                   		 if (reg.test($("#card_number").val()) === false) { 
                   			 layer.msg('身份证输入不合法!');
                       		//$('#confirm_dialog').css('display','block');
            		         return false;  
            		      };
							//处理县总值
                        		if($("#province select:eq(2)").val()=="请选择"){
                        			county = '';
                        		}else{
                        			county=$("#province select:eq(2)").val();
                        		}
                            var formData = new FormData($("#commentFrom")[0]);
                            //formData.append("manage_locations", county); 
                           // formData.append("province", $("#province select:eq(0)").val());
							$.ajax({
                                url: "",
                                type: 'POST',
                                data: formData,
                                async: false,
                                cache: false,
                                contentType: false,
                                processData: false,
                                success: function (returndata) {
	                                	obj = jQuery.parseJSON(returndata);
	                              	 if(obj.code==1){
		                                 layer.msg(obj.msg);
		                                 window.parent.location.reload();
		                                 var index = parent.layer.getFrameIndex(window.name);
		                                	parent.layer.close(index);
	                                }else{
	                                		layer.msg(obj.msg);
	                                } 
                                },
                                error: function (returndata) {
                                    alert(returndata);
                                }
                            });
                        }
                        /*
                         参数解释：
                         title	标题
                         url		请求的url
                         id		需要操作的数据id
                         w		弹出层宽度（缺省调默认值）
                         h		弹出层高度（缺省调默认值）
                         */
                        /*管理员-增加*/
                        function admin_add(title, url, w, h) {
                            layer_show(title, url, w, h);
                        }
                        /*管理员-删除*/
                        function admin_del(obj, id) {
                            layer.confirm('确认要删除吗？', function (index) {
                                //此处请求后台程序，下方是成功后的前台处理……

                                $(obj).parents("tr").remove();
                                layer.msg('已删除!', {icon: 1, time: 1000});
                            });
                        }
                        /*管理员-编辑*/
                        function admin_edit(title, url, id, w, h) {
                            layer_show(title, url, w, h);
                        }
                        /*管理员-停用*/
                        function admin_stop(obj, id) {
                            layer.confirm('确认要停用吗？', function (index) {
                                //此处请求后台程序，下方是成功后的前台处理……

                                $(obj).parents("tr").find(".td-manage").prepend('<a onClick="admin_start(this,id)" href="javascript:;" title="启用" style="text-decoration:none"><i class="Hui-iconfont">&#xe615;</i></a>');
                                $(obj).parents("tr").find(".td-status").html('<span class="label label-default radius">已禁用</span>');
                                $(obj).remove();
                                layer.msg('已停用!', {icon: 5, time: 1000});
                            });
                        }

                        /*管理员-启用*/
                        function admin_start(obj, id) {
                            layer.confirm('确认要启用吗？', function (index) {
                                //此处请求后台程序，下方是成功后的前台处理……


                                $(obj).parents("tr").find(".td-manage").prepend('<a onClick="admin_stop(this,id)" href="javascript:;" title="停用" style="text-decoration:none"><i class="Hui-iconfont">&#xe631;</i></a>');
                                $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
                                $(obj).remove();
                                layer.msg('已启用!', {icon: 6, time: 1000});
                            });
                        }

    </script>
</body>
</html>